$:.unshift(File.dirname(__FILE__) + '/../lib')


require 'test/unit'
require File.expand_path(File.join(File.dirname(__FILE__), '/../../../../config/environment.rb'))


config = YAML::load(IO.read(File.dirname(__FILE__) + '/database.yml'))
ActiveRecord::Base.logger = Logger.new(File.dirname(__FILE__) + "/debug.log")
if !ActiveRecord::Base.connected?
  ActiveRecord::Base.establish_connection(config[ENV['DB'] || 'postgresql'])
  load(File.dirname(__FILE__) + "/test_schema.rb") unless ENV['NO_SCHEMA_LOAD'] == 'true'
end

